package wang.Collect;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class list_bianli {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();


        list.add("sadljl");
        list.add("sadl");
        list.add("sadlj");

        for (String s : list) {
            if ("sadl".equals(s)) {
                list.remove(s);
            }
            for (String string : list) {
                System.out.println(string);
            }

            //System.out.println(s);

        }
        System.out.println(list);

//
//       Iterator<String> i=listfangfa.iterator();
//
//        while (i.hasNext()){
//
//            System.out.println(i.next());
//        }

        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });


        list.forEach(s -> System.out.println(s));


    }
}
